package com.right.service.impl;

import com.right.dao.ManagerDao;
import com.right.dao.impl.ManagerDaoImpl;
import com.right.entity.Manager;
import com.right.service.ManagerService;

public class ManagerServiceIpml implements ManagerService {
	ManagerDao md = new ManagerDaoImpl();
	
	@Override
	public boolean login(String name, String pwd) {
		if (name==null||pwd==null) {
			return false;
		}
		return md.login(name, pwd);
	}

	@Override
	public boolean addManager(Manager manager) {
		if (manager == null) {
			return false;
		}if (md.getUserByName(manager.getName())!=null) {
			return false;
		}
		return md.addManager(manager);
	}

	@Override
	public boolean updateManager(Manager manager) {
		if (manager == null) {
			return false;
		}if (md.getUserByName(manager.getName())!=null) {
			return false;
		}
		return md.updateManager(manager);
		
	}

}
